Overview

This document/repository contains and outlines the re-analysis of the data presented in Davenport et al 2021 Davenport et al. (2021), as re-re-analysed by Andrew Jones.

The authors were made aware of a bug or error in the output-files used in both NeEstimator and Colony to estimate the number of breeders per cohort. This error caused the data to become shuffled. Below, analysis is presented comparing the published data to files made directly from the original raw data. The input files for Nb estimation for NeEstimator and COLONY are re-made using raw data (based on the published loci) and the updated results are presented. The published work further sought to combine estimators of effective size to make reporting and decision making easier - combined estimates of Nb per-cohort. Here using the revised results we also make these re-estimates.

An additional sensitivity analysis is performed on the full dataset to illustrate how the inclusion of different SNPs and individuals can affect final point-estimates of effective size, and highlights the importance of considering confidence intervals (i.e using a 95%CI we expect that 95% of the time the true value of the parameter lies in its interval), as well as various estimators in conservation decisions. S

Background

In Davenport et al., 2021, the effective number of breeders (Nb) was estimated in 4 consecutive cohorts (2010-2013) based on the premise that when a genetic sample contains only individuals from a single age cohort (a group of individuals having the same age-class), then the estimate of effective population size (Ne) from a single-sample estimator in species with overlapping generations corresponds to the effective number of breeders (Nb). For long-lived, iteroparous species such as the white shark, estimates of Nb are generally considered more useful for monitoring as they apply to a single breeding season (rather than needing a sample representative of a generation - an assumption of Ne (see Waples (2022))), and it represents an accessible parameter for monitoring population trends at ecological timescales most relevant to conservation and management needs. Nb is particularly useful in cases where juvenile or YOY samples can be easily collected (i.e. through SMART shark program NSW). Estimating Nb and monitoring its change over time allows timely detection of population trends (decline, restoration, recovery, expansion), even if using as few as four or five consecutive reproductive cycles (Leberg (2005); Wang (2005); Luikart et al. (2021)).

Data

The original DArT data for this project can be found in the file /Data/Raw

The results of the reanalysis can be found in /Results.

The filtered list of loci from the published analysis can be found in Data/Raw/Report-DSha18-3402/File_Formats/Genepop_NeEstimator_Input/nswdpi_whiteshark_gp.gen.

The loci names were extracted from this document to ensure the data from the publication are used in the reanalysis here. Readers are referred to the original publication Davenport et al. (2021) for more detailed methods. In summary, a list of loci/SNPs which meet the articles filtering criteria are saved in the ‘.gen’ file. These are used here to re-make the input files for NeEstimator and COLONY from the original raw-data, from which Nb per cohort is re-estimated.The full raw data is also used to re-estimate Nb using a sensitivity analysis of loci/individuals.

The processed Data is found in /Data/processed.

Confirmation of Issue in Original Manuscript

For this section I follow the approach used by Dani as far as was required to confirm the work of Dean and Paul.

Setup data

A bug in an R-package used in the original publication is suspected to have introduced inconsistencies into the output files used in the final analysis.

## Starting :: 
##  Starting dartR 
##  Starting gi2gl 
## Starting gl.compliance.check 
##   Processing genlight object with SNP data
##   The slot loc.all, which stores allele name for each locus, is empty. 
## Creating a dummy variable (A/C) to insert in this slot. 
##   Checking coding of SNPs
##     SNP data scored NA, 0, 1 or 2 confirmed
##   Checking locus metrics and flags
##   Recalculating locus metrics
##   Checking for monomorphic loci
##     Dataset contains monomorphic loci
##   Checking for loci with all missing data
##     No loci with all missing data detected
##   Checking whether individual names are unique.
##   Checking for individual metrics
##   Warning: Creating a slot for individual metrics
##   Checking for population assignments
##     Population assignments confirmed
##   Spelling of coordinates checked and changed if necessary to 
##             lat/lon
## Completed: gl.compliance.check 
## Completed: :: 
##  Completed: dartR 
##  Completed: gi2gl
## Starting :: 
##  Starting dartR 
##  Starting gl.read.dart 
## Starting utils.read.dart 
##   Topskip not provided.
##  Setting topskip to 6 .
##   Reading in the SNP data
##   Detected 2 row format.
## Number of rows per clone (should be only  2 s): 2 
##  Added the following locus metrics:
## AlleleID AlleleSequence TrimmedSequence Chrom_Shark_Callorhinchus_v1 ChromPos_Shark_Callorhinchus_v1 AlnCnt_Shark_Callorhinchus_v1 AlnEvalue_Shark_Callorhinchus_v1 SNP SnpPosition CallRate OneRatioRef OneRatioSnp FreqHomRef FreqHomSnp FreqHets PICRef PICSnp AvgPIC AvgCountRef AvgCountSnp RepAvg .
## Recognised: 278 individuals and 9841  SNPs in a 2 row format using Data/Raw/Report_DSha18-3402_SNP_2_ReLabeled.csv 
## Completed: utils.read.dart 
## Starting utils.dart2genlight 
## Starting conversion....
## Format is 2 rows.
## Please note conversion of bigger data sets will take some time!
## Once finished, we recommend to save the object using save(object, file="object.rdata")
## Completed: utils.dart2genlight 
##  Data read in. Please check carefully the output above
##   Read depth calculated and added to the locus metrics
##   Minor Allele Frequency (MAF) calculated and added to the locus metrics
##   Recalculating locus metrics provided by DArT (optionally specified)
## Completed: :: 
##  Completed: dartR 
##  Completed: gl.read.dart
## [1] 3668   24
## [1] 3668   24
## [1] 1 2 3 4 5 6
## [1] 1 2 3 4 5 6

Quantify differences in missingness between the published and new dataset

# compare the old and the new files for missingness
# print out each genlight to get info on missngness, loci, invidual
orig_gl
##  /// GENLIGHT OBJECT /////////
## 
##  // 241 genotypes,  3,668 binary SNPs, size: 1.2 Mb
##  4506 (0.51 %) missing data
## 
##  // Basic content
##    @gen: list of 241 SNPbin
##    @ploidy: ploidy of each individual  (range: 2-2)
## 
##  // Optional content
##    @ind.names:  241 individual labels
##    @loc.names:  3668 locus labels
##    @loc.all:  3668 alleles
##    @pop: population of each individual (group size range: 1-63)
##    @other: a list containing: loc.metrics  loc.metrics.flags  verbose  history  ind.metrics
new_gl
##  ********************
##  *** DARTR OBJECT ***
##  ********************
## 
##  ** 241 genotypes,  3,668 SNPs , size: 5.7 Mb
## 
##     missing data: 4503 (=0.51 %) scored as NA
## 
##  ** Genetic data
##    @gen: list of 241 SNPbin
##    @ploidy: ploidy of each individual  (range: 2-2)
## 
##  ** Additional data
##    @ind.names:  241 individual labels
##    @loc.names:  3668 locus labels
##    @loc.all:  3668 allele labels
##    @position: integer storing positions of the SNPs [within 69 base sequence]
##    @pop: population of each individual (group size range: 1-63)
##    @other: a list containing: loc.metrics, ind.metrics, loc.metrics.flags, verbose, history 
##     @other$ind.metrics: service, plate_location 
##     @other$loc.metrics: AlleleID, AlleleSequence, TrimmedSequence, Chrom_Shark_Callorhinchus_v1, ChromPos_Shark_Callorhinchus_v1, AlnCnt_Shark_Callorhinchus_v1, AlnEvalue_Shark_Callorhinchus_v1, SNP, SnpPosition, CallRate, OneRatioRef, OneRatioSnp, FreqHomRef, FreqHomSnp, FreqHets, PICRef, PICSnp, AvgPIC, AvgCountRef, AvgCountSnp, RepAvg, clone, uid, rdepth 
##    @other$latlon[g]: no coordinates attached
# compare the old and the new files for missingness
# print out each genlight to get info on missngness, loci, invidual
new_gl
##  ********************
##  *** DARTR OBJECT ***
##  ********************
## 
##  ** 241 genotypes,  3,668 SNPs , size: 5.7 Mb
## 
##     missing data: 4503 (=0.51 %) scored as NA
## 
##  ** Genetic data
##    @gen: list of 241 SNPbin
##    @ploidy: ploidy of each individual  (range: 2-2)
## 
##  ** Additional data
##    @ind.names:  241 individual labels
##    @loc.names:  3668 locus labels
##    @loc.all:  3668 allele labels
##    @position: integer storing positions of the SNPs [within 69 base sequence]
##    @pop: population of each individual (group size range: 1-63)
##    @other: a list containing: loc.metrics, ind.metrics, loc.metrics.flags, verbose, history 
##     @other$ind.metrics: service, plate_location 
##     @other$loc.metrics: AlleleID, AlleleSequence, TrimmedSequence, Chrom_Shark_Callorhinchus_v1, ChromPos_Shark_Callorhinchus_v1, AlnCnt_Shark_Callorhinchus_v1, AlnEvalue_Shark_Callorhinchus_v1, SNP, SnpPosition, CallRate, OneRatioRef, OneRatioSnp, FreqHomRef, FreqHomSnp, FreqHets, PICRef, PICSnp, AvgPIC, AvgCountRef, AvgCountSnp, RepAvg, clone, uid, rdepth 
##    @other$latlon[g]: no coordinates attached

These results show the number of individuals and the number of loci does not change between the published and the new dataset. However, the number of missing data in the published dataset is 4506, while the re-analysis dataset missingingess is 4503.

Visualise the difference between the published and new dataset

Discussion of error

More details available in Dani’s report and Dean and Paul’s report.

Main points:

  • Error definitely present as described in analyis by Dean and Paul.
  • Error changes data in a way that would be expected to have some impact estimates of Nb
  • Error needs to be corrected

Corrected Ne Estimates

New cohort assignment

The new cohort assignment file “Data/Processed/New_Cohort_Assignment.tsv” was created by running the script Scripts/Age_at_Length.R.

The von Bertanlaffy parameters used are from are from O’Connor (2011).

New Input files for NeEstimator and COLONY

Below the input files for NeEstimator and COLONY are remade to make new estimates of Nb using a new file made from the published list of loci (“new_gp”).

dartR is used write out a genepop file, and a custom script to write out a COLONY file.

## 
## 2005 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 
##    1    3    6   11   29   41   52   64   23    9    2
## Starting :: 
##  Starting dartR 
##  Starting gl2genepop 
##   Processing genlight object with SNP data
##   The genepop file is saved as:  Data/Processed/NeEstimator/new.gen/
## Completed: :: 
##  Completed: dartR 
##  Completed: gl2genepop

Run COLONY

Run NeEstimator

Cobmine and Save All Estimates Code

Run Combination Estimates Code

Year Nb_LD_est Nb_LD_lower Nb_LD_upper Nb_SA_est Nb_SA_lower Nb_SA_upper Nb_COM_est Nb_COM_lower Nb_COM_upper
2010 61.2 31.9 257.4 96.0 60.0 192.0 75.6 56.4 94.8
2011 205.7 109.8 1023.9 234.0 146.0 504.0 222.7 169.7 275.6
2012 214.8 134.0 489.2 204.0 139.0 331.0 206.0 166.7 245.3
2013 171.9 117.3 301.7 152.0 108.0 218.0 154.2 128.7 179.7
2014 103.3 48.8 10445.4 127.0 70.0 424.0 113.7 79.9 147.5

Results

Outputs of NeEstimator and of Colony are saved in Report/NbResults.xlsx , where jacknife CIs are reported for pcrit = 0.05.

Summary Plots

Plot of Nb estimates with 95% confidence intervals

Plot of Nb estimates with 95% confidence intervals

The combined estimates are also plotted here. The error bars in this case represent +- SD, not a confidence interval.

Plot of Combined Nb estimates +- SD

Plot of Combined Nb estimates +- SD

Stability

I take stability to mean that there are no significant differences between the Nb estimates for any years, this corresponds to the null hypothesis that Nb_2010 = Nb_2011 = Nb_2012 = Nb_2013.

LD

The situation is very difficult to evaluate graphically. The point estimates for 2010 and 2014 sit outside the common region (dark grey), but the 2011-2013 estimates (and the entirity of their CIs) lie entirely within the CIs for other years. No hard conclusions can be drawn from examining the individual CIs alone.

LD estimates with 95% CIs and values which fall in all CIs marked as a grey rectangle

LD estimates with 95% CIs and values which fall in all CIs marked as a grey rectangle

In order to examine this formally, we will need to construct pairwise tests. This needs to be done with \(r^{*}\) as LDNe confidence intervals do not have normal CIs. The confidence intervals for \(r^{*}\) in LDNe are approximately normal. This method of comparison is statistically consistent with manner used in the construction of the CIs [cite: Jones, Ovenden and Wang (2016)].

A slightly more accurate result could be obtained by pulling the results directly from the LDNe code, and making minor adjustments to account for the fact this is only approximately normal, however I do not believe this would make a difference in this case.

The following table summarises the pairwise comparisons of the Nb estimates in terms of Nb. The first two columns identify which years are being compared, the third and forth columns state the relevant \(r^{*}\) values.

Their difference and the estimate for the standard deviation of the estimate follow. The combined standard deviation is found by taking the square root of the sum the of the two variances. This assumes both estimates are independent. While it is likely these estimates are correlated with each other, we have no way of accurately estimating their covariance so I believe it is best to assume independence.

The z-score and p-value are based on the ordinary z-test for the difference of two normaly distributed variables. The adjusted p-values are adjusted using the Bonferonni [actually used Holm FIX] method on the basis that we are making 6 pairwise comparisons and we wish to keep our family-wise error rate below 0.05. None of the unadjusted p-values were significant at the 0.05 level anyway.

data$rstar_LD_lower <- Ne_to_r_star(data$Nb_LD_lower, data$S) 
data$rstar_LD_upper <- Ne_to_r_star(data$Nb_LD_upper, data$S) 
data$rstar_LD_est <- Ne_to_r_star(data$Nb_LD_est, data$S) 
data$rstar_sd_mean <- (data$rstar_LD_lower - data$rstar_LD_upper) / (2*qnorm(0.9750))

results_frame <- data.frame("Year1" = NA, "Year2"= NA, "r1"= NA, "r2"= NA, "diff"= NA, "combined sd"= NA, "z-score"= NA, "p-value"= NA) %>% na.omit()

for(i in 1:(nrow(data)-1)){
  for(j in (i+1):nrow(data)){
    temp <- c(
      data$Year[i],
      data$Year[j],
      data$rstar_LD_est[i],
      data$rstar_LD_est[j],
      data$rstar_LD_est[i]-data$rstar_LD_est[j],
      sqrt(data$rstar_sd_mean[i]^2 + data$rstar_sd_mean[j]^2), 
      (data$rstar_LD_est[i]-data$rstar_LD_est[j]) / sqrt(data$rstar_sd_mean[i]^2 + data$rstar_sd_mean[j]^2),
      1-pnorm(abs(data$rstar_LD_est[i]-data$rstar_LD_est[j]) / sqrt(data$rstar_sd_mean[i]^2 + data$rstar_sd_mean[j]^2))
      
    )
    
    results_frame[nrow(results_frame) + 1,] <- temp
  
  }
}

results_frame$p.value.adj <- p.adjust(results_frame$p.value, "holm")
results_frame %>% gt() %>% opt_stylize() %>% fmt_number(columns = c(7:9), decimals = 3) %>% fmt_number(columns = c(3:6), n_sigfig =  3)
Year1 Year2 r1 r2 diff combined.sd z.score p.value p.value.adj
2010 2011 0.000891 0.000269 0.000622 0.000391 1.592 0.056 0.501
2010 2012 0.000891 0.000258 0.000634 0.000382 1.661 0.048 0.484
2010 2013 0.000891 0.000322 0.000570 0.000381 1.495 0.067 0.539
2010 2014 0.000891 0.000531 0.000360 0.000468 0.768 0.221 1.000
2011 2012 0.000269 0.000258 0.0000113 0.000137 0.082 0.467 1.000
2011 2013 0.000269 0.000322 −0.0000527 0.000135 −0.389 0.349 1.000
2011 2014 0.000269 0.000531 −0.000263 0.000304 −0.864 0.194 1.000
2012 2013 0.000258 0.000322 −0.0000640 0.000106 −0.607 0.272 1.000
2012 2014 0.000258 0.000531 −0.000274 0.000292 −0.938 0.174 1.000
2013 2014 0.000322 0.000531 −0.000210 0.000291 −0.721 0.235 1.000

SA

With the updated results, the intervals for the SA method are no longer mutually disjoint. Analysis is much the same as for LD now.

The analysis proceeds in a similar manner as for \(r^{*}\).

data$Nb_SA_est_inv <- 1 / (2*data$Nb_SA_est)

data$vstar_lower <- ((1/data$Nb_SA_lower - 1/data$Nb_SA_est) / (2*qnorm(0.9750)))^2
data$vstar_upper <- ((1/data$Nb_SA_est - 1/data$Nb_SA_upper) / (2*qnorm(0.9750)))^2

data$vstar_mean <- (data$vstar_upper+data$vstar_lower)/2

results_frame <- data.frame("Year1" = NA, "Year2"= NA, "2Nb^-1 1"= NA, "2Nb^-1 2"= NA, "diff"= NA, "combined sd"= NA, "z-score"= NA, "p-value"= NA) %>% na.omit()

for(i in 1:(nrow(data)-1)){
  for(j in (i+1):nrow(data)){
    temp <- c(
      data$Year[i],
      data$Year[j],
      data$Nb_SA_est_inv[i],
      data$Nb_SA_est_inv[j],
      data$Nb_SA_est_inv[i]-data$Nb_SA_est_inv[j],
      sqrt(data$vstar_mean[i] + data$vstar_mean[j]), 
      (data$Nb_SA_est_inv[i]-data$Nb_SA_est_inv[j]) / sqrt(data$vstar_mean[i] + data$vstar_mean[j]),
      1-pnorm(abs(data$Nb_SA_est_inv[i]-data$Nb_SA_est_inv[j]) / sqrt(data$vstar_mean[i] + data$vstar_mean[j]))
      
    )
    
    results_frame[nrow(results_frame) + 1,] <- temp
  
  }
}

results_frame$p.value.adj <- p.adjust(results_frame$p.value, "holm")

names(results_frame)[3:4] <-c('(2Ne)^-1 1', '(2Ne)^-1 2') 
results_frame %>% gt() %>% opt_stylize() %>% fmt_number(columns = c(6:9), decimals = 3) %>% fmt_number(columns = c(3:5), n_sigfig =  3)
Year1 Year2 (2Ne)^-1 1 (2Ne)^-1 2 diff combined.sd z.score p.value p.value.adj
2010 2011 0.00521 0.00214 0.00307 0.002 1.927 0.027 0.270
2010 2012 0.00521 0.00245 0.00276 0.002 1.765 0.039 0.349
2010 2013 0.00521 0.00329 0.00192 0.002 1.210 0.113 0.793
2010 2014 0.00521 0.00394 0.00127 0.002 0.601 0.274 0.823
2011 2012 0.00214 0.00245 −0.000314 0.001 −0.383 0.351 0.823
2011 2013 0.00214 0.00329 −0.00115 0.001 −1.332 0.091 0.732
2011 2014 0.00214 0.00394 −0.00180 0.002 −1.093 0.137 0.823
2012 2013 0.00245 0.00329 −0.000838 0.001 −1.041 0.149 0.823
2012 2014 0.00245 0.00394 −0.00149 0.002 −0.919 0.179 0.823
2013 2014 0.00329 0.00394 −0.000648 0.002 −0.395 0.347 0.823

After adjustment for multiple comparisons, there is still a significant difference between 2010 and 2011 (p = 0.045). The situation is somewhat confusing here as the estimates for 2011, 2012 and 2013 are not significantly different from 2010.

I had a number of reservations about this analysis, but I have included this analysis as I believe it is important.

These issues are:

  • I am much less familiar with the CIs for COLONY than for LDNe
  • The accuracy of extracting the variance from the CI bounds was very high, at the time of the original paper I put this down to the fact it rounds to whole numbers, but I’m not longer sure
  • The estimate for 2010 has the narrowest CI bounds while having the lowest sample size. This is ‘correct’ and is based on the high number of sibling pairs assigned by COLONY.
  • I have not been able to spend as much time checking this as I would like

Discussion

It’s stable

Plot of Nb estimates with 95% confidence intervals

Plot of Nb estimates with 95% confidence intervals

46 width r(bands_SA$band_upper+bands_SA$band_lower)/2 mean

References

Davenport, Danielle, Paul Butcher, Sara Andreotti, Conrad Matthee, Andrew Jones, and Jennifer Ovenden. 2021. “Effective Number of White Shark (Carcharodon Carcharias, Linnaeus) Breeders Is Stable over Four Successive Years in the Population Adjacent to Eastern Australia and New Zealand.” Ecology and Evolution 11 (1): 186–98.
Leberg, Paul. 2005. “Genetic Approaches for Estimating the Effective Size of Populations.” The Journal of Wildlife Management 69 (4): 1385–99.
Luikart, Gordon, Tiago Antao, Brian K. Hand, Clint C. Muhlfeld, Matthew C. Boyer, Ted Cosart, Brian Trethewey, Robert Al-Chockhachy, and Robin S. Waples. 2021. “Detecting Population Declines via Monitoring the Effective Number of Breeders (Nb).” Molecular Ecology Resources 21 (2): 379–93. https://doi.org/10.1111/1755-0998.13251.
O’Connor, J. 2011. “Age, Growth and Movement Signatures of the White Shark (Carcharodon Carcharias) in Southern Australia.” The University of Technology Sydney.
Wang, J. 2005. “Estimation of Effective Population Sizes from Data on Genetic Markers.” Philosophical Transactions of the Royal Society B: Biological Sciences 360 (1459): 1395–1409. https://doi.org/10.1098/rstb.2005.1682.
Waples, Robin S. 2022. “What Is N e, Anyway?” Edited by William Murphy. Journal of Heredity 113 (4): 371–79. https://doi.org/10.1093/jhered/esac023.